package com.design.mediator;

/**
 * @author leali
 * @title: SubConcreteMediator
 * @projectName design
 * @description: 新增具体中介者类
 * @date 2022/1/3 20:06
 */
public class SubConcreteMediator extends ConcreteMediator {
    /**
     * 增加对Label对象的引用
     */
    public Label label;

    @Override
    public void componentChanged(Component component) {
        //单击按钮
        if (component == button) {
            System.out.println("--单击增加按钮--");
            listBox.update();
            comboBox.update();
            textBox.update();
            label.update();
        }
        //从列表框选择客户
        else if (component == listBox) {
            System.out.println("--从列表框选择客户--");
            comboBox.select();
            textBox.setText();
        }
        //从组合框选择客户
        else if (component == comboBox) {
            System.out.println("--从组合框选择客户--");
            comboBox.select();
            textBox.setText();
        }
    }
}
